<!DOCTYPE html>
<html id='root'>
<body>
<span id='target'>16-char header. This text is initially selected. 16-char footer.</span>
<script>
    function select() {
        var text = document.getElementById('target').firstChild;
        var range = document.createRange();
        range.setStart(text, 16);
        range.setEnd(text, 48);
        window.getSelection().addRange(range);
    }
    window.onload = select;
</script>
</body>
</html>

